import { getFinancialInfoById } from '@/api/network'
import { ref } from 'vue'

export default () => {
  // 获取财务信息加载
  const getFinancialInfoLoading = ref(false)

  // 财务信息
  const financialInfo = ref({
    bandName: '',
    bandNo: '',
    businessLicenseImage: '',
    businessLicenseNo: '',
    cardholderName: '',
    settlementType: 2,
  })

  /**
   * 获取财务信息
   * @param {string} networkId - 网点id
   */
  const getFinancialInfo = async (networkId: string) => {
    getFinancialInfoLoading.value = true
    const res = await getFinancialInfoById(networkId)
    getFinancialInfoLoading.value = false
    financialInfo.value = res.data.data.row
  }

  return {
    financialInfo,
    getFinancialInfoLoading,
    getFinancialInfo,
  }
}
